package us.mmapp;

import us.mmapp.util.ThumbnailUtil;

import android.app.Activity;
import android.app.ProgressDialog;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.ImageView;

public class ViewImageActivity extends Activity implements Runnable
{
	ProgressDialog progressDialog;
	ImageView iv;
	Bitmap b;
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.viewimage);
		iv=(ImageView)findViewById(R.id.viewimage);
		progressDialog=ProgressDialog.show(this, "", "Loading...");
		Thread thread = new Thread(this);
        thread.start();
		//ThumbnailUtil.setImageView(this, b.getInt("keyword"), iv, false);
		
	}
	@Override
	public void onPause()
	{
		super.onPause();
		System.gc();
	}
	@Override
	public void run()
	{
		Bundle bundle=this.getIntent().getExtras();
		b=ThumbnailUtil.getBitmap(this, bundle.getInt("keyword"), false);
		handler.sendEmptyMessage(0);
	}
	private Handler handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
                progressDialog.dismiss();
           
                iv.setImageBitmap(b);

        }
	};
}
